
export function hasLogin() {
  try {
    return wx.getStorageSync('token')
  } catch (e) {
    return false
  }
}

export function refreshLoginStatus(token) {
  wx.setStorage({
    key: "token",
    data: token,
    success: () => {
      hasLogin()
    },
    fail: (err) => {
      return false
    }
  })
}

export function saveVisaType(visa) {
  wx.setStorage({
    key: "lastVisa",
    data: visa,
    fail: (err) => {
      return false
    }
  })
}

export function getLastVisaType() {
  try {
    return wx.getStorageSync('lastVisa')
  } catch (e) {
    return false
  }
}